<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            margin: 0;
            width: 100vw;
            height: 100vh;
            position: relative;
        }
        .box {
            width: 200px;
            height: 150px;
            line-height: 150px;
            text-align: center;
            font-size: 50px;
            outline: 5px solid red;
            /* float: left; */
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            transition: transform 1s ease;
            background-color: white;
        }
        .container {
            perspective: 1000px;
            perspective-origin: center center;
            width: 1000px;
            height: 150px;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
        }
        .box:nth-child(1) {
            transform: translateX(-50%) translateX(-200%) translateZ(0);
        }
        .box:nth-child(2) {
            transform: translateX(-50%) translateX(-100%) translateZ(150px);
        }
        .box:nth-child(3) {
            transform: translateX(-50%) translateX(0%) translateZ(300px);
        }
        .box:nth-child(4) {
            transform: translateX(-50%) translateX(100%) translateZ(150px);
        }
        .box:nth-child(5) {
            transform: translateX(-50%) translateX(200%) translateZ(0);
            z-index: -18;
        }

        #next-btn:hover+.container>.box:nth-child(2) {
            transform: translateX(-50%) translateX(0%) translateZ(300px);
        }
        #next-btn:hover+.container>.box:nth-child(3) {
            transform: translateX(-50%) translateX(100%) translateZ(150px);
        }
        #next-btn:hover+.container>.box:nth-child(4) {
            transform: translateX(-50%) translateX(200%) translateZ(0);
        }
        #next-btn:hover+.container>.box:nth-child(5) {
            transform: translateX(-50%) translateX(-200%) translateZ(0);
        }
        #next-btn:hover+.container>.box:nth-child(1) {
            transform: translateX(-50%) translateX(-100%) translateZ(150px);
        }
    </style>
</head>
<body>
    <button id="prev-btn">左</button>
    <button id="next-btn">右</button>
    <div class="container">
        <div class="box">1</div>
        <div class="box">2</div>
        <div class="box">3</div>
        <div class="box">4</div>
        <div class="box">5</div>
    </div>
</body>
</html>